package com.zhanghuan.scheduler.job.controller;

import com.zhanghuan.scheduler.job.entity.R;
import com.zhanghuan.scheduler.job.service.ScheduleJobLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/sys/schedulelog")
@CrossOrigin
public class ScheduleJobLogController {

    @Autowired
    ScheduleJobLogService scheduleJobLogService;

    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        if( params==null || params.isEmpty() ){
            params = new HashMap<>();
            params.put("page",0);
            params.put("limit",10);
        }
        return R.ok().put("page", scheduleJobLogService.queryPage(params));
    }
}
